package com.zjhd.sealcutting.controller;

import com.zjhd.sealcutting.domain.ExhibitionInfo;
import com.zjhd.sealcutting.domain.OperationLog;
import com.zjhd.sealcutting.param.ExhibitionSearchQuery;
import com.zjhd.sealcutting.param.OperationLogSearchQuery;
import com.zjhd.sealcutting.service.OperationLogService;
import com.zjhd.sealcutting.utils.response.ResponseResult;
import com.zjhd.sealcutting.utils.response.ResultGenerator;
import com.zjhd.sealcutting.vo.SearchResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO  操作日志管理
 *
 * @author wangchao
 * @version 1.0
 * @date 2020/12/11 11:46
 */
@Api(value = "操作日志管理", tags = "操作日志管理")
@RequestMapping("/operationLog")
@RestController
public class OperationLogController {

    private final static Logger logger = LoggerFactory.getLogger(OperationLogController.class);

    @Autowired
    private OperationLogService operationLogService;

    @ApiOperation(value = "分页查询操作日志列表接口", notes = "分页查询操作日志列表接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "searchName", value = "操作用户", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "操作起始时间", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "操作截止时间", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "页大小", defaultValue = "10", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "pageIndex", value = "页码", defaultValue = "1", dataType = "String", paramType = "query")
    })
    @GetMapping("/queryOperationLogParamlist")
    public ResponseResult<SearchResult<OperationLog>> queryOperationLogParamlist(OperationLogSearchQuery param){
        try{
            return ResultGenerator.genSuccessResult(operationLogService.queryOperationLogParamlist(param));
        }catch (Exception ex) {
            logger.error("分页查询操作日志列表接口失败", ex);
            return ResultGenerator.genFailResult("分页查询操作日志列表接口失败");
        }
    }
}
